import time
from ddt import ddt


def count_time(func):
    def wrapper():
        # 获取当前时间
        st = time.time()
        func()
        et = time.time()
        print(f"函数{func}执行时间:{et - st}")

    return wrapper


@count_time
def work1():
    for i in range(3):
        time.sleep(0.3)


t = work1()


# 装饰器应用2
def sort_(func):
    def wrapper():
        result = func()
        result.sort(key=lambda x: x[2])
        return result

    return wrapper


@sort_
def list_():
    a = [(1, 2, 4), (3, 5, 2), (4, 5, 3)]
    return a


b = list_()
print(b)
